]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspaceThumbnail: Consider porthole offsets
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 26 Feb 2021 12:36:26 +0000 (13:36 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 26 Feb 2021 13:36:39 +0000 (14:36 +0100)
Since commit 9980c806191f, the porthole position is ignored. As a result,
previews are only shown if the primary monitor is located at (0, 0).

To fix this, we either need to propagate the porthole to every thumbnail,
use a custom layout manager that applies an offset to all children, or
add an intermediate actor that offsets the contents.

The last option is the simplest and doesn't require calls into JS on
every allocation, so pick that one.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3781

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1721>

js/ui/workspaceThumbnail.js

index 933a0d5d4ad8eb358e312ffc9311883897024e1a..457ae755456584bc5cf23123622488a309e44938 100644 (file)
@@ -271,8 +271,11 @@ var WorkspaceThumbnail = GObject.registerClass({
 
         this._removed = false;
 
+        this._viewport = new Clutter.Actor();
+        this.add_child(this._viewport);
+
         this._contents = new Clutter.Actor();
-        this.add_child(this._contents);
+        this._viewport.add_child(this._contents);
 
         this.connect('destroy', this._onDestroy.bind(this));
 
@@ -315,7 +318,8 @@ var WorkspaceThumbnail = GObject.registerClass({
     }
 
     setPorthole(x, y, width, height) {
-        this._contents.set_size(width, height);
+        this._viewport.set_size(width, height);
+        this._contents.set_position(-x, -y);
     }
 
     _lookupIndex(metaWindow) {
@@ -598,7 +602,7 @@ var WorkspaceThumbnail = GObject.registerClass({
     }
 
     setScale(scaleX, scaleY) {
-        this._contents.set_scale(scaleX, scaleY);
+        this._viewport.set_scale(scaleX, scaleY);
     }
 });